package com.py.credit.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.py.credit.common.Page;
import com.py.credit.dao.TemplateForLhjcDao;
import com.py.credit.service.TemplateForLhjcService;
import com.py.credit.utils.SQLBuilder;

@Service
public class TemplateForLhjcServiceImpl implements TemplateForLhjcService {

	@Autowired
	private TemplateForLhjcDao templateForLhjcDao;


	@Override
	public List<Map> getByConditionForPage(List<String> columns,String[] additionalColumns, String conditionStr, Page page) {
		List<String> conditions = SQLBuilder.createConditionSql(conditionStr);
		List<Map> list = templateForLhjcDao.selectByConditionForPage(columns,additionalColumns,conditions,page);

		return list;
	}



	@Override
	public Map selectOne(int id) {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectOne(id);
	}


	@Override
	public List<Map<String, Object>> selectMbCode(String name) {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectMbCode(name);
	}


	@Override
	public String selectDb() {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectDb();
	}



	@Override
	public void startEnable(int id) {
		templateForLhjcDao.startEnable(id);
		
	}



	@Override
	public void del(String ids) {
		List<String> listIds=Arrays.asList(ids.split(","));
		templateForLhjcDao.del(listIds);
		
	}



	@Override
	public void add(String name, String status, String content) {
		templateForLhjcDao.add(name, status, content);
		
	}



	@Override
	public void modify(int id, String name,String isDel, String status, String content) {
		templateForLhjcDao.modify(id, name,isDel, status, content);
		
	}



	@Override
	public int selectSameName(String name) {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectSameName(name);
	}



	@Override
	public int selectSameStatus(int id,String status) {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectSameStatus(id,status);
	}



	@Override
	public int selectOtherSameName(int id, String name) {
		// TODO Auto-generated method stub
		return templateForLhjcDao.selectOtherSameName(id, name);
	}
	
	@Override
	public Integer countEnable(String ids) {
		// TODO Auto-generated method stub
		List<String> listIds=Arrays.asList(ids.split(","));
		return templateForLhjcDao.countEnable(listIds);
	}



	@Override
	public void endEnable(int id) {
		templateForLhjcDao.endEnable(id);
		
	}


}
